package edu.fub.pub2search.geo;

/**
 * A helper class to store data in longitude and latitude.
 * 
 * @author Josef
 */
public class GeoPosition {
	
	/** Micro scale */
	public static final int MICRO = 1000000;
	
	/** Latitude */
	public int x;
	
	/** Longitude */
	public int y;
	
	/**
	 * Create a default GeoPosition. It points to Bolzano BZ, Italy.
	 */
	public GeoPosition() {
		this.x = 46495166;
		this.y = 11354103;
	}
	
	/**
	 * Create a custom GeoPosition.
	 * 
	 * @param x The latitude in micro-degrees (degrees * 1E6).
	 * @param y The longitude in micro-degrees (degrees * 1E6).
	 */
	public GeoPosition(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	/**
	 * Convert to degrees.
	 * 
	 * @return Returns the degrees.
	 */
	public static double toDegrees(int microdegree) {
		return (double) microdegree / GeoPosition.MICRO;
	}
	
	/**
	 * Convert to micro-degrees.
	 * 
	 * @return Returns the micro-degrees.
	 */
	public static int toMicroDegrees(double degree) {
		return (int) (degree * GeoPosition.MICRO);
	}
}
